import { IProfile } from '@/types/user'

const PROFILE_KEY = '🥦'

/**
 * 存储用户信息
 * @param profile IProfile
 */
export const setProfile = (profile: IProfile) => localStorage.setItem(PROFILE_KEY, JSON.stringify(profile))

/**
 * 获取用户信息
 * @returns IProfile
 */
export const getProfile = (): IProfile => JSON.parse(localStorage.getItem(PROFILE_KEY) || '{}')

/**
 * 删除用户信息
 */
export const removeProfile = () => localStorage.removeItem(PROFILE_KEY)
